package com.example.pc.updata;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.pc.http.Base_Z_Adapter;
import com.example.pc.http.CuoT;
import com.example.pc.updata.Baes.YongHu;


/**
 * Created by 他的猫 on 2016/12/3.
 * 我的went适配器
 */

public class WDCT_Adapter extends Base_Z_Adapter {
    WDCT_Adapter.Holder holder;


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        // 查找控件
        if (null == convertView) {
            convertView = LayoutInflater.from(MyApplication.getInstance())
                    .inflate(R.layout.item_yhgl, null);
            holder = new WDCT_Adapter.Holder();
            holder.kemu = (TextView) convertView
                    .findViewById(R.id.kemu);
            holder.name = (TextView) convertView
                    .findViewById(R.id.name);

            holder.xuehao = (TextView) convertView
                    .findViewById(R.id.xuehao);
            holder.laoshiname = (TextView) convertView
                    .findViewById(R.id.laoshiname);


            holder.time = (TextView) convertView
                    .findViewById(R.id.time);
            holder.shijianduan = (TextView) convertView
                    .findViewById(R.id.shijianduan);
            holder.dizhi = (TextView) convertView
                    .findViewById(R.id.dizhi);

            // 缓存Holder
            convertView.setTag(holder);
        } else {
            holder = (WDCT_Adapter.Holder) convertView.getTag();
        }
        CuoT.DataBean teacher = (CuoT.DataBean) mDataList.get(position);
        holder.kemu.setText("题目:" + teacher.getTm());
        holder.laoshiname.setText("正确答案:" + teacher.getZq());
        holder.time.setText("我的答案：" + teacher.getCw());
        holder.shijianduan.setText("解析：" + teacher.getJx());
        holder.dizhi.setVisibility(View.GONE);

        return convertView;
    }

    public class Holder {
        TextView name, kemu, xuehao, laoshiname, time, shijianduan, dizhi;
    }


}
